package org.fage.semples.model;

import java.io.Serializable;
import java.util.Set;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.OneToMany;
import javax.persistence.Table;

@Entity
@Table(name = "exam_user")
public class ExamUser implements Serializable {

	private static final long serialVersionUID = 6867334017438076192L;

	@Id
	@Column(name = "user_id",nullable = false)
	private String userId;
	
	@Column(name = "user_name", length = 45, nullable = false)
	private String userName;
	
	@Column(name = "password", length = 225, nullable = false)
	private String password = "123456";
	
	@Column(name = "tel", length = 20, nullable = false)
	private String tel;
	
	@Column(name = "email", length = 225, nullable = false)
	private String email = "123456@qq.com";
	
	@Column(name = "address", length = 225, nullable = false)
	private String address;
	
	@Column(name = "birthday", nullable = false)
	private String birthday;
	
	@Column(name = "gender", nullable = false)
	private int gender;
	
	@Column(name = "last_lock_time", nullable = false)
	private Date lastLockTime = new Date();
	
	@Column(name = "login_fail_count", nullable = false)
	private int loginFailCount = 0;
	
	@OneToMany(mappedBy = "examUser")
	private Set<ExamUserSubject> examUserSubject;
	
	@OneToMany(mappedBy = "examUser")
	private Set<ExamUserRole> examUserRole;

	public ExamUser(String userId, String userName, String password, String tel, String email, String address,
			String birthday, int gender, Date lastLockTime, int loginFailCount, Set<ExamUserSubject> examUserSubject,
			Set<ExamUserRole> examUserRole) {
		super();
		this.userId = userId;
		this.userName = userName;
		this.password = password;
		this.tel = tel;
		this.email = email;
		this.address = address;
		this.birthday = birthday;
		this.gender = gender;
		this.lastLockTime = lastLockTime;
		this.loginFailCount = loginFailCount;
		this.examUserSubject = examUserSubject;
		this.examUserRole = examUserRole;
	}

	public ExamUser() {
		super();
		// TODO Auto-generated constructor stub
	}

	public String getUserId() {
		return userId;
	}

	public void setUserId(String userId) {
		this.userId = userId;
	}

	public String getUserName() {
		return userName;
	}

	public void setUserName(String userName) {
		this.userName = userName;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;
	}

	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getEmail() {
		return email;
	}

	public void setEmail(String email) {
		this.email = email;
	}

	public String getAddress() {
		return address;
	}

	public void setAddress(String address) {
		this.address = address;
	}

	public String getBirthday() {
		return birthday;
	}

	public void setBirthday(String birthday) {
		this.birthday = birthday;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}

	public Date getLastLockTime() {
		return lastLockTime;
	}

	public void setLastLockTime(Date lastLockTime) {
		this.lastLockTime = lastLockTime;
	}

	public int getLoginFailCount() {
		return loginFailCount;
	}

	public void setLoginFailCount(int loginFailCount) {
		this.loginFailCount = loginFailCount;
	}

	public Set<ExamUserSubject> getExamUserSubject() {
		return examUserSubject;
	}

	public void setExamUserSubject(Set<ExamUserSubject> examUserSubject) {
		this.examUserSubject = examUserSubject;
	}

	public Set<ExamUserRole> getExamUserRole() {
		return examUserRole;
	}

	public void setExamUserRole(Set<ExamUserRole> examUserRole) {
		this.examUserRole = examUserRole;
	}

	public static long getSerialversionuid() {
		return serialVersionUID;
	}
	
	
	
	
}
